package com.loe.ui.util

import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView

class HorizontalDecoration(var pL: Int = 0, var pT: Int = 0, var pR: Int = 0, var pB: Int = 0, var space: Int = 0, var startSize: Int = 0) : RecyclerView.ItemDecoration()
{
    override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State)
    {
        val index = parent.getChildAdapterPosition(view)

        if(index < startSize)
        {
            return
        }

        outRect.top = pT
        outRect.bottom = pB
        if (index == startSize)
        {
            outRect.left = pL
        }else
        {
            outRect.left = space
        }
        if (index == state.itemCount - 1)
        {
            outRect.right = pR
        }
    }
}